<?php
include("db/connect.php");
include("prename.php");

$sqlselectcustomer="select * from customer,province,amphur,tambol";
$sqlselectcustomer.=" where customer.province_id=province.province_id and";
$sqlselectcustomer.=" customer.amphur_id=amphur.amphur_id and";
$sqlselectcustomer.=" customer.tambol_id=tambol.tambol_id and";
$sqlselectcustomer.=" cus_id like '%".@$_POST["txtsearch"]."%' group by cus_id";
$queryselectcustomer=mysql_query($sqlselectcustomer);
?>
<table width="100%" height="132" cellpadding="0" cellspacing="0" border="0" class="tb_customer display"   style="font-size:14px">
<thead>
  <tr>
  	<th width="21%">ชื่อ-นามสกุล</th>
    <th width="32%">ที่อยู่</th>
    <th width="13%">รหัสไปรษณีย์</th>
    <th width="12%">เบอร์โทรศัพท์</th>
    <th width="5%">Email</th>
    <th width="5%">แก้ไข</th>
    <th width="5%">ลบ</th>
    <th width="7%">สั่งซื้อสินค้า</th>
  </tr>
  </thead>
  <tbody style="color:black !important;">
  <?php 
  while($resultcustomer=mysql_fetch_array($queryselectcustomer)){
  ?>
  <tr>
  	<td><?php echo (prename($resultcustomer["cus_title"])."".$resultcustomer["cus_name"])." ".$resultcustomer["cus_lastname"]?></td>
    <td><?php echo $resultcustomer["cus_addr"]." ต.".$resultcustomer["tambol_name"]." อ.".$resultcustomer["amphur_name"]." จ.".$resultcustomer["province_name"]?></td>
    <td><?php echo $resultcustomer["cus_postal"]?></td>

    <td><?php echo  $resultcustomer["cus_tel"]?></td>
    <td><?php echo $resultcustomer["cus_mail"]?></td>
    <td><a href="Javascript:ajaxmanage(2,<?php echo $resultcustomer["cus_id"];?>);">แก้ไข</a></td>
    <td><a href="Javascript:ajaxmanage(1,<?php echo $resultcustomer["cus_id"];?>);" onclick="return window.confirm('ต้องการลบใช่ไหม')">ลบ</a></td>
    <td><a href="Javascript:ajaxmanage(5,<?php echo $resultcustomer["cus_id"];?>);">สั่งซื้อสินค้า</a></td>
  </tr>
  <?php }?>
  </tbody>
</table>
<script>
$(document).ready(function(){

  	var oTable3 = $('.tb_customer').dataTable({
          "bJQueryUI": true,
          "sPaginationType": "full_numbers"
      });
});
	  
	
</script>
